import request from '@/utils/request'

export function loginByUsername(username, password) {
  const data = {
    username,
    password
  }
  return new Promise(function(res, ref) {
    // enterprise  admin
    const data = { data: {
      roles: ['enterprise'],
      token: 'enterprise',
      introduction: '我是超级管理员1',
      avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
      name: 'Super Admin'
    }}
    res(data)
  })
}

export function logout() {
  return request({
    url: '/login/logout',
    method: 'post'
  })
  // return true;
}

export function getUserInfo(token) {
  return new Promise(function(res, ref) {
    const data = { data: {
      roles: ['enterprise'],
      token: 'enterprise',
      introduction: '我是超级管理员2',
      avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
      name: 'Super Admin'
    }}
    res(data)
  })
}

